using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Resource.@string;
using MicroMsg.Scene.Video;
using MicroMsg.Scene.Voice;
using MicroMsg.Storage;
using MicroMsg.UI.Page;
using MicroMsg.UI.Util;
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Xml.Linq;
namespace MicroMsg.UI.UserContrl
{
	public class ChatListItem : StackPanel, MMItemCtrl, BaseHeadImgItem
	{
		private const string TAG = "ChatListItem";
		private FrameworkElement realElement;
		private int oldMsgType = -100;
		private int oldMsgSender = -100;
		private MsgTrans mMsgTrans;
		public static DependencyProperty ListItemProperty;
		public static HeadImgLoadService mHeadImgLoadService;
		private string cuUser;
		public ChatMsg ItemObject
		{
			get
			{
				return (ChatMsg)base.GetValue(ChatListItem.ListItemProperty);
			}
			set
			{
				base.SetValue(ChatListItem.ListItemProperty, value);
			}
		}
		public string UserName
		{
			get
			{
				return this.cuUser;
			}
		}
		public T getRealItem<T>() where T : BaseChatElement
		{
			if (this.realElement == null)
			{
				return default(T);
			}
			return this.realElement as T;
		}
		public void Refresh()
		{
			ChatMsg itemObject = this.ItemObject;
			if (itemObject == null)
			{
				return;
			}
			if (this.realElement == null)
			{
				return;
			}
			BaseChatElement baseChatElement = this.realElement as BaseChatElement;
			baseChatElement.SetChatMsg(itemObject);
			if (itemObject is ChatTimeMsg)
			{
				return;
			}
			ContactMgr.getUserType(itemObject.strTalker);
			itemObject.IsSysInfo();
			bool flag = ContactMgr.getUserType(itemObject.strTalker) == ContactMgr.UserType.UserTypeQQ;
			string text = "";
			string text2 = "";
			if (!ChatMsgMgr.getMsgUser(itemObject, ref text, ref text2))
			{
				Log.smethod_1("ChatListItem", "getMsgUser failed,content is: " + itemObject.strMsg);
			}
			this.cuUser = text;
			baseChatElement.cuImgUser = text;
			if (this.cuUser.Contains("@bottle"))
			{
				if (this.cuUser == AccountMgr.strUsrName + "@bottle")
				{
					baseChatElement.SetHeadSrc(AccountMgr.getBottletHeadimg());
				}
				else
				{
					string gparam_ = BContactMgr.toBottleContactUserName(text);
					BottleContact item = StorageMgr.bContact.method_0(gparam_);
					baseChatElement.SetHeadSrc(HeadImgMgr.getHeadImage(item));
				}
			}
			else
			{
				if (flag)
				{
					baseChatElement.SetHeadSrc(HeadImgMgr.tryGetNowQQHeadImage(text));
				}
				else
				{
					baseChatElement.SetHeadSrc(HeadImgMgr.getHeadImage(text, true));
				}
			}
			if (itemObject.IsAppMsg())
			{
				AppMsgInfo appMsgInfo = AppMsgMgr.parseAppXml(itemObject.strMsg);
				if (appMsgInfo == null)
				{
					Log.smethod_1("ChatListItem", "invalid app msg = " + itemObject.strMsg);
					appMsgInfo = new AppMsgInfo();
					appMsgInfo.description = strings.Chat_msg_err;
					return;
				}
				if (appMsgInfo.showtype == 1)
				{
					baseChatElement.SetItemClick(new ChatItemClick(this.MultyPicArticleClicked));
					return;
				}
				if ((long)appMsgInfo.type == 1L)
				{
					baseChatElement.SetMsgContent(appMsgInfo.title);
					return;
				}
				if ((long)appMsgInfo.type == 2L)
				{
					string msgThumbnail = ChatMsgMgr.getMsgThumbnail(itemObject);
					if (string.IsNullOrEmpty(msgThumbnail))
					{
						Log.smethod_1("ChatListItem", "getThumbnailByMsgSvrID=NULL,item.nMsgSvrID：" + itemObject.nMsgSvrID);
					}
					baseChatElement.SetImgSrc(msgThumbnail);
					baseChatElement.SetItemClick(new ChatItemClick(this.ImgItemClickHandle));
					return;
				}
				if ((long)appMsgInfo.type != 5L)
				{
					if ((long)appMsgInfo.type == 7L)
					{
						return;
					}
					baseChatElement.SetItemClick(new ChatItemClick(this.AppMusicItemClickHandle));
					return;
				}
			}
			else
			{
				if (itemObject.IsImage())
				{
					string msgThumbnail2 = ChatMsgMgr.getMsgThumbnail(itemObject);
					if (string.IsNullOrEmpty(msgThumbnail2))
					{
						Log.smethod_1("ChatListItem", "getThumbnailByMsgSvrID=NULL,item.nMsgSvrID：" + itemObject.nMsgSvrID);
					}
					baseChatElement.SetImgSrc(msgThumbnail2);
					if (itemObject.nIsSender != 0)
					{
						if (itemObject.GetStatus() == MsgUIStatus.Processing)
						{
							ChatPageCtrl cuChatPage = ChatContainerPage.getCuChatPage();
							if (cuChatPage != null)
							{
								baseChatElement.SetProgress(cuChatPage.GetPicProgress(itemObject.nMsgLocalID));
								Log.smethod_5("ChatListItem", string.Concat(new object[]
								{
									"item:id ",
									itemObject.nMsgLocalID,
									" progress  ",
									cuChatPage.GetPicProgress(itemObject.nMsgLocalID)
								}));
							}
						}
						else
						{
							baseChatElement.SetProgress(100);
							Log.smethod_5("ChatListItem", "item:id " + itemObject.nMsgLocalID + "chatItem.IsGlittleing=false");
						}
					}
					baseChatElement.SetItemClick(new ChatItemClick(this.ImgItemClickHandle));
					return;
				}
				if (itemObject.IsVoice())
				{
					this.mMsgTrans = new MsgTrans();
					if (DownloadVoiceService.parseVoiceMsgXML(text2, this.mMsgTrans))
					{
						baseChatElement.SetVoiceLen((this.mMsgTrans.nDuration + 499) / 1000);
					}
					else
					{
						baseChatElement.SetVoiceLen(1);
						Log.smethod_1("ChatListItem", "DownloadVoiceService.parseVoiceMsgXML error:nMsgLocalID(" + itemObject.nMsgLocalID + ")");
					}
					baseChatElement.SetItemClick(new ChatItemClick(this.VoiceItemClickHandle));
					baseChatElement.SetUnReadFlag(ChatMsgMgr.getVoiceStatus(itemObject));
					if (VoiceService.IsReceived(this.ItemObject))
					{
						ChatPageCtrl cuChatPage2 = ChatContainerPage.getCuChatPage();
						if (cuChatPage2 != null)
						{
							cuChatPage2.ReceivedVoice(this.ItemObject, this.realElement as ChatVoiceItem);
							return;
						}
					}
				}
				else
				{
					if (itemObject.IsFmessage())
					{
						baseChatElement.SetItemClick(new ChatItemClick(this.FMessageItemClickHandle));
						return;
					}
					if (itemObject.IsQQMailmessage())
					{
						baseChatElement.SetItemClick(new ChatItemClick(this.QQMailMessageItemClickHandle));
						return;
					}
					if (itemObject.IsShareCard())
					{
						baseChatElement.SetItemClick(new ChatItemClick(this.ShareCardItemClickHandle));
						return;
					}
					if (itemObject.isQmessageTxt())
					{
						string strTalker = itemObject.strTalker;
						string strMsg = itemObject.strMsg;
						ChatMsgMgr.getQQOfflineMsg(itemObject.strMsg, ref strTalker, ref strMsg);
						baseChatElement.SetMsgContent(strMsg);
						return;
					}
					if (itemObject.IsVideo())
					{
						string text3 = text2;
						MsgTrans msgTrans = new MsgTrans();
						string msgThumbnail3 = ChatMsgMgr.getMsgThumbnail(itemObject);
						if (DownloadVideoService.parseVideoMsgXML(text3, msgTrans))
						{
							ChatVideoItem chatVideoItem = baseChatElement as ChatVideoItem;
							if (chatVideoItem != null)
							{
								chatVideoItem.RefreshUI(msgTrans, msgThumbnail3);
							}
						}
						else
						{
							Log.smethod_1("ChatListItem", "parseVideoMsgXML false:" + text3);
						}
						baseChatElement.SetItemClick(new ChatItemClick(this.VideoItemClickHandle));
						return;
					}
					if (itemObject.IsMap())
					{
						string xmlStr = text2;
						ChatMapInfo mapinfo = new ChatMapInfo();
						ChatMapItem chatMapItem = baseChatElement as ChatMapItem;
						if (chatMapItem != null && ChatMapItem.parseMapMsgXML(xmlStr, mapinfo))
						{
							chatMapItem.RefreshUI(mapinfo);
						}
						baseChatElement.SetItemClick(new ChatItemClick(this.MapItemClickHandle));
						return;
					}
					if (string.IsNullOrEmpty(text2))
					{
						baseChatElement.SetMsgContent("");
						return;
					}
					baseChatElement.SetMsgContent(text2);
				}
			}
		}
		public ChatListItem()
		{
			base.add_Loaded(new RoutedEventHandler(this.ChatListItem_Loaded));
			base.add_Unloaded(new RoutedEventHandler(this.ChatListItem_Unloaded));
		}
		private void ChatListItem_Unloaded(object sender, RoutedEventArgs e)
		{
			ChatListItem.mHeadImgLoadService.Delete(this);
		}
		private void ChatListItem_Loaded(object sender, RoutedEventArgs e)
		{
			ChatListItem.mHeadImgLoadService.Add(this);
		}
		public FrameworkElement GetUIElementToCache()
		{
			if (this.realElement == null)
			{
				return null;
			}
			FrameworkElement result = this.realElement;
			base.get_Children().Remove(this.realElement);
			this.realElement = null;
			return result;
		}
		public void UILoadHander(RoutedEventHandler loadedEventHandler)
		{
			if (this.ItemObject == null)
			{
				if (loadedEventHandler != null)
				{
					loadedEventHandler.Invoke(null, null);
				}
				return;
			}
			if (this.realElement != null && this.oldMsgType == this.ItemObject.nMsgType)
			{
				if (this.oldMsgSender == this.ItemObject.nIsSender)
				{
					this.Refresh();
					if (loadedEventHandler != null)
					{
						loadedEventHandler.Invoke(null, null);
					}
					return;
				}
			}
			this.realElement = this.getItemByMsg(this.ItemObject);
			this.oldMsgType = this.ItemObject.nMsgType;
			this.oldMsgSender = this.ItemObject.nIsSender;
			if (loadedEventHandler != null)
			{
				this.realElement.add_Loaded(loadedEventHandler);
			}
			this.Refresh();
			base.get_Children().Clear();
			base.get_Children().Add(this.realElement);
		}
		private void RefreshItem(ChatMsg item)
		{
			if (item == null)
			{
				return;
			}
			if (item.IsPushMsg())
			{
				return;
			}
			if (ChatContainerPage.getCuChatPage() == null)
			{
				return;
			}
			this.UILoadHander(null);
		}
		private void VoiceItemClickHandle(ChatMsg chatMsg_0, BaseChatElement chatElement)
		{
			if (chatMsg_0 == null)
			{
				return;
			}
			if (!chatMsg_0.IsVoice())
			{
				return;
			}
			if (this.mMsgTrans == null)
			{
				return;
			}
			ChatPageCtrl cuChatPage = ChatContainerPage.getCuChatPage();
			if (cuChatPage == null)
			{
				return;
			}
			ChatVoiceItem chatVoiceItem = chatElement as ChatVoiceItem;
			if (chatVoiceItem == null)
			{
				return;
			}
			string msgVoice = ChatMsgMgr.getMsgVoice(chatMsg_0);
			cuChatPage.VoiceItemClick(msgVoice, chatMsg_0, chatVoiceItem);
		}
		private void ImgItemClickHandle(ChatMsg chatMsg_0, BaseChatElement chatElement)
		{
			if (chatMsg_0 == null)
			{
				return;
			}
			if (!chatMsg_0.IsImage() && !chatMsg_0.IsAppMsg())
			{
				return;
			}
			if (chatMsg_0.GetStatus() == MsgUIStatus.Processing && !chatMsg_0.IsSender())
			{
				MessageBoxManager.ShowToast(strings.Chat_Img_Send_Alert, 2500, null, false);
				return;
			}
			BasePage rootPage = chatElement.GetRootPage<BasePage>();
			if (rootPage == null)
			{
				return;
			}
			ChatImgItem chatImgItem = chatElement as ChatImgItem;
			if (chatImgItem == null)
			{
				return;
			}
			Image img = chatImgItem.GetImg();
			if (img == null)
			{
				return;
			}
			Point relativePosition = this.GetRelativePosition(img, rootPage);
			Point point = new Point(img.get_ActualWidth(), img.get_ActualHeight());
			object[] object_ = new object[]
			{
				chatMsg_0,
				relativePosition,
				point
			};
			if (chatElement.GetRootPage<ChatPageCtrl>() == null)
			{
				return;
			}
			if (chatMsg_0.IsImage())
			{
				rootPage.GoToPage("/Source/UI/Chat/SlideImageView/ChatSlideImgPage.xaml", object_, false);
				return;
			}
			if (chatMsg_0.IsAppMsg())
			{
				rootPage.GoToPage("/Source/UI/Chat/ImageView.xaml", object_, false);
			}
		}
		public Point GetRelativePosition(UIElement element, UIElement other)
		{
			return element.TransformToVisual(other).Transform(new Point(0.0, 0.0));
		}
		private void FMessageItemClickHandle(ChatMsg chatMsg_0, BaseChatElement chatElement)
		{
			if (chatMsg_0 == null)
			{
				return;
			}
			ChatFMessage chatFMessage = chatElement as ChatFMessage;
			if (chatFMessage == null)
			{
				return;
			}
			chatFMessage.ItemClickHandle(chatMsg_0);
		}
		private void QQMailMessageItemClickHandle(ChatMsg chatMsg_0, BaseChatElement chatElement)
		{
			if (chatMsg_0 == null)
			{
				return;
			}
			if (QQMailMgr.parseMailXml(chatMsg_0.strMsg) == null)
			{
				MMMessageBox.Show(strings.Plugin_news_readfail, true, "确定");
				return;
			}
			QQMailMessageItem qQMailMessageItem = chatElement as QQMailMessageItem;
			if (qQMailMessageItem == null)
			{
				return;
			}
			qQMailMessageItem.ItemClickHandle(chatMsg_0);
		}
		private void ShareCardItemClickHandle(ChatMsg chatMsg_0, BaseChatElement chatElement)
		{
			if (chatMsg_0 == null)
			{
				return;
			}
			ChatCardItem chatCardItem = chatElement as ChatCardItem;
			if (chatCardItem == null)
			{
				return;
			}
			chatCardItem.ItemClickHandle(chatMsg_0);
		}
		private void VideoItemClickHandle(ChatMsg chatMsg_0, BaseChatElement chatElement)
		{
			if (chatMsg_0 == null)
			{
				return;
			}
			ChatVideoItem chatVideoItem = chatElement as ChatVideoItem;
			if (chatVideoItem == null)
			{
				return;
			}
			MainPage mainPageInstance = MainPage.mainPageInstance;
			if (mainPageInstance == null)
			{
				return;
			}
			if (chatVideoItem.mTrans == null)
			{
				return;
			}
			mainPageInstance.GoToPage("/Source/UI/Chat/VideoPlayerPage.xaml", new object[]
			{
				chatMsg_0,
				chatVideoItem
			}, false);
		}
		private void MapItemClickHandle(ChatMsg chatMsg_0, BaseChatElement chatElement)
		{
			if (chatMsg_0 == null)
			{
				return;
			}
			if (!chatMsg_0.IsMap())
			{
				return;
			}
			MainPage mainPageInstance = MainPage.mainPageInstance;
			if (mainPageInstance == null)
			{
				return;
			}
			ChatMapItem chatMapItem = chatElement as ChatMapItem;
			if (chatMapItem == null)
			{
				return;
			}
			if (chatMapItem.mInfo == null)
			{
				return;
			}
			MapPage.SelectCustomMapPage(mainPageInstance, MapPage.PageType.ReceivePage, this.cuUser, chatMapItem.mInfo.double_0, chatMapItem.mInfo.double_1, chatMapItem.mInfo.scale, chatMapItem.mInfo.label);
		}
		private void AppMusicItemClickHandle(ChatMsg chatMsg_0, BaseChatElement chatElement)
		{
			if (chatMsg_0 == null)
			{
				return;
			}
			ChatPageCtrl cuChatPage = ChatContainerPage.getCuChatPage();
			if (cuChatPage == null)
			{
				return;
			}
			ChatAppMsgMusicItem chatAppMsgMusicItem = chatElement as ChatAppMsgMusicItem;
			if (chatAppMsgMusicItem == null)
			{
				return;
			}
			AppMsgInfo appMsgInfo = AppMsgMgr.parseAppXml(chatMsg_0.strMsg);
			if (appMsgInfo == null)
			{
				return;
			}
			if (appMsgInfo.type == 3)
			{
				cuChatPage.MusicItemClick(chatMsg_0, chatAppMsgMusicItem);
			}
		}
		private void MultyPicArticleClicked(ChatMsg chatMsg_0, BaseChatElement chatElement)
		{
		}
		private FrameworkElement getItemByMsg(ChatMsg item)
		{
			if (ChatContainerPage.mItemCacheService == null)
			{
				return new ChatLeftText();
			}
			ItemCacheService mItemCacheService = ChatContainerPage.mItemCacheService;
			if (item is ChatTimeMsg)
			{
				return new ChatTimeItem();
			}
			if (item.IsSysInfo())
			{
				return new ChatSysInfoItem();
			}
			if (item.nIsSender != 0)
			{
				if (item.IsImage())
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.IMG_R);
				}
				if (item.IsCustomSmiley())
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.CUSTOM_R);
				}
				if (item.IsVoice())
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.VOICE_R);
				}
				if (item.IsFmessage())
				{
					return new ChatFMessage();
				}
				if (item.IsShareCard())
				{
					return new ChatRightCardItem();
				}
				if (item.IsVideo())
				{
					return new ChatRightVideo();
				}
				if (item.IsMap())
				{
					return new ChatRightMap();
				}
				if (!item.IsAppMsg())
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.TXT_R);
				}
				AppMsgInfo appMsgInfo = AppMsgMgr.parseAppXml(item.strMsg);
				if (appMsgInfo == null || appMsgInfo.type > 7)
				{
					Log.smethod_1("ChatListItem", "invalid appmsg, xml = " + item.strMsg);
					return new ChatRightAppMsgMusicItem();
				}
				if (appMsgInfo.showtype == 1)
				{
					return new ChatMultyPicArticleItem();
				}
				if (appMsgInfo.type == 1)
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.TXT_R);
				}
				if (appMsgInfo.type == 2)
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.IMG_R);
				}
				if ((long)appMsgInfo.type != 5L)
				{
					if ((long)appMsgInfo.type != 7L)
					{
						return new ChatRightAppMsgMusicItem();
					}
				}
				return new ChatRightAppMsgLinkItem();
			}
			else
			{
				if (item.IsImage())
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.IMG_L);
				}
				if (item.IsCustomSmiley())
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.CUSTOM_L);
				}
				if (item.IsVoice())
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.VOICE_L);
				}
				if (item.IsFmessage())
				{
					return new ChatFMessage();
				}
				if (item.IsQQMailmessage())
				{
					return new QQMailMessageItem();
				}
				if (item.IsShareCard())
				{
					return new ChatLeftCardItem();
				}
				if (item.IsVideo())
				{
					return new ChatLeftVideo();
				}
				if (item.IsMap())
				{
					return new ChatLeftMap();
				}
				if (!item.IsAppMsg())
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.TXT_L);
				}
				AppMsgInfo appMsgInfo2 = AppMsgMgr.parseAppXml(item.strMsg);
				if (appMsgInfo2 == null || appMsgInfo2.type > 7)
				{
					Log.smethod_1("ChatListItem", "invalid appmsg, xml = " + item.strMsg);
					return new ChatLeftAppMsgMusicItem();
				}
				if (appMsgInfo2.showtype == 1)
				{
					return new ChatMultyPicArticleItem();
				}
				if (appMsgInfo2.type == 1)
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.TXT_L);
				}
				if (appMsgInfo2.type == 2)
				{
					return mItemCacheService.GetItemByType(Chat_UI_Type.IMG_L);
				}
				if ((long)appMsgInfo2.type != 5L)
				{
					if ((long)appMsgInfo2.type != 7L)
					{
						return new ChatLeftAppMsgMusicItem();
					}
				}
				return new ChatLeftAppMsgLinkItem();
			}
		}
		static ChatListItem()
		{
			ChatListItem.mHeadImgLoadService = new HeadImgLoadService(false);
			ChatListItem.ListItemProperty = DependencyProperty.Register("ItemObject", typeof(ChatMsg), typeof(ChatListItem), new PropertyMetadata(null, new PropertyChangedCallback(ChatListItem.OnItemPropertyChanged)));
		}
		private static void OnItemPropertyChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			if (dependencyPropertyChangedEventArgs_0.get_Property() == ChatListItem.ListItemProperty)
			{
				(dependencyObject_0 as ChatListItem).OnListItemPropertyChanged(dependencyPropertyChangedEventArgs_0);
			}
		}
		private void OnListItemPropertyChanged(DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			try
			{
				this.RefreshItem(dependencyPropertyChangedEventArgs_0.get_NewValue() as ChatMsg);
			}
			catch (Exception ex)
			{
				Log.smethod_1(base.GetType().get_Name(), ex.get_StackTrace());
				DebugEx.debugBreak();
			}
		}
		public static bool parseVoiceMsgXML(string xmlStr, MsgTrans voiceinfo)
		{
			if (!string.IsNullOrEmpty(xmlStr) && voiceinfo != null)
			{
				bool result;
				try
				{
					XDocument xDocument = XDocument.Parse(xmlStr);
					XElement xElement = xDocument.Element("msg").Element("voicemsg");
					XAttribute xAttribute = xElement.Attribute("clientmsgid");
					if (xAttribute != null)
					{
						voiceinfo.strClientMsgId = xAttribute.get_Value();
					}
					xAttribute = xElement.Attribute("length");
					if (xAttribute != null)
					{
						voiceinfo.nTotalDataLen = int.Parse(xAttribute.get_Value());
					}
					xAttribute = xElement.Attribute("endflag");
					if (xAttribute != null)
					{
						voiceinfo.nEndFlag = int.Parse(xAttribute.get_Value());
					}
					xAttribute = xElement.Attribute("voicelength");
					if (xAttribute != null)
					{
						voiceinfo.nDuration = int.Parse(xAttribute.get_Value());
					}
					xAttribute = xElement.Attribute("fromusername");
					if (xAttribute != null)
					{
						voiceinfo.strFromUserName = xAttribute.get_Value();
					}
					return true;
				}
				catch (Exception ex)
				{
					Log.smethod_5("ChatListItem", ex.get_Message());
					result = false;
				}
				return result;
			}
			Log.smethod_5("ChatListItem", "parseVoiceMsgXML, input invalid para");
			return false;
		}
		public static bool parseGroupChatVoiceMsgXML(string xmlStr, MsgTrans voiceinfo)
		{
			if (!string.IsNullOrEmpty(xmlStr) && voiceinfo != null)
			{
				int num = xmlStr.IndexOf('\n');
				if (num >= 0 && num < Enumerable.Count<char>(xmlStr) - 1)
				{
					xmlStr = xmlStr.Substring(num + 1);
				}
				bool result;
				try
				{
					XDocument xDocument = XDocument.Parse(xmlStr);
					XElement xElement = xDocument.Element("msg").Element("voicemsg");
					XAttribute xAttribute = xElement.Attribute("clientmsgid");
					if (xAttribute != null)
					{
						voiceinfo.strClientMsgId = xAttribute.get_Value();
					}
					xAttribute = xElement.Attribute("length");
					if (xAttribute != null)
					{
						voiceinfo.nTotalDataLen = int.Parse(xAttribute.get_Value());
					}
					xAttribute = xElement.Attribute("endflag");
					if (xAttribute != null)
					{
						voiceinfo.nEndFlag = int.Parse(xAttribute.get_Value());
					}
					xAttribute = xElement.Attribute("voicelength");
					if (xAttribute != null)
					{
						voiceinfo.nDuration = int.Parse(xAttribute.get_Value());
					}
					xAttribute = xElement.Attribute("fromusername");
					if (xAttribute != null)
					{
						voiceinfo.strFromUserName = xAttribute.get_Value();
					}
					return true;
				}
				catch (Exception ex)
				{
					Log.smethod_5("ChatListItem", ex.get_Message());
					result = false;
				}
				return result;
			}
			Log.smethod_5("ChatListItem", "parseVoiceMsgXML, input invalid para");
			return false;
		}
		public void HeadImgLoaded()
		{
			BaseChatElement baseChatElement = this.realElement as BaseChatElement;
			if (baseChatElement == null)
			{
				return;
			}
			if (!this.cuUser.Contains("@bottle"))
			{
				baseChatElement.SetHeadSrc(HeadImgMgr.getHeadImage(this.cuUser, true));
				return;
			}
			if (this.cuUser == AccountMgr.strUsrName + "@bottle")
			{
				baseChatElement.SetHeadSrc(AccountMgr.getBottletHeadimg());
				return;
			}
			string gparam_ = BContactMgr.toBottleContactUserName(this.cuUser);
			BottleContact item = StorageMgr.bContact.method_0(gparam_);
			baseChatElement.SetHeadSrc(HeadImgMgr.getHeadImage(item));
		}
		public void ScreenIn()
		{
		}
		public void ScreenOut()
		{
		}
	}
}
